Add behavioral_drift: fine-tuning output integrity metric beyond loss curves#778
Open
YuhaoLin2005 wants to merge 1 commit into
Open
Add behavioral_drift: fine-tuning output integrity metric beyond loss curves#778YuhaoLin2005 wants to merge 1 commit into
YuhaoLin2005 wants to merge 1 commit into
Conversation
Three-signal composite (self-BLEU, digit density, repetition ratio) that catches fine-tuning collapse invisible to perplexity alone. 147 lines, zero external dependencies beyond evaluate+datasets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this solve?
Loss curves improve during fine-tuning and everyone ships. But loss can drop while every output degenerates into repeating digit sequences or near-identical strings. Perplexity does not catch this — it measures token-level prediction quality, not output integrity. BLEU/ROUGE do not catch this either — they measure n-gram overlap against ground truth, not behavioral collapse against a baseline.
There is currently no metric in evaluate that catches this class of failure.
How it works
behavioral_drift composites three signals into a single drift_score (0-1, lower = worse):
Each signal has a documented threshold. A diagnosis string is returned alongside the score.
Relationship to existing metrics
Not a replacement for perplexity or BLEU. An orthogonal behavioral check. Intended workflow: run drift_score alongside your standard eval suite. If perplexity improves but drift_score drops, you have a silent quality regression.
Implementation